package com.saas.sql;

public class LinksQuery
{
  public static String links_SEL_INDEXLINK_BY_NAME = "select distinct ui.cust_name,l.trade_id,l.link_name,l.link_addr,l.link_comment,l.cust_id,l.oper_user,l.oper_time from links l inner join user_info ui on ui.cust_id=l.cust_id  where l.cust_id=:VCUST_ID and l.link_name like :VLINK_NAME order by l.oper_time desc";
  public static String links_SEL_BY_NAME = "select distinct ui.cust_name,l.trade_id,l.link_name,l.link_addr,l.link_comment,l.cust_id,l.oper_user from links l inner join user_info ui on ui.cust_id=l.cust_id where l.link_name like :VLINK_NAME group by l.trade_id order by l.add_time desc";
  public static String links_SEL_INDEXLINK_BY_CUST_ID = "select distinct ui.cust_name,l.trade_id,l.link_name,l.link_addr,l.link_comment,l.cust_id,l.oper_user from links l inner join user_info ui on ui.cust_id=l.cust_id  where l.cust_id=:VCUST_ID order by l.add_time desc";
  public static String links_SEL_INDEXLINK_BY_ID = "select distinct ui.cust_name,l.trade_id,l.link_name,l.link_addr,l.link_comment,l.cust_id,l.oper_user from links l inner join user_info ui on ui.cust_id=l.cust_id where l.trade_id=:VTRADE_ID order by l.add_time desc ";
  public static String links_SEL_INDEXLINK_ALL = "select distinct ui.cust_name,l.trade_id,l.link_name,l.link_addr,l.link_comment,l.cust_id,l.oper_user from links l inner join user_info ui on ui.cust_id=l.cust_id order by l.add_time desc ";
  public static String links_SEL_BY_All = "select distinct ui.cust_name,l.trade_id,l.link_name,l.link_addr,l.link_comment,l.cust_id,l.oper_user from links l inner join user_info ui on ui.cust_id=l.cust_id group by l.trade_id order by l.add_time desc";
  public static String links_INS_INDEXLINK_ONE = "insert into links(trade_id,link_name,link_addr,link_comment,cust_id,oper_user,oper_time,add_time) values(:VTRADE_ID,:VLINK_NAME,:VLINK_ADDR,:VLINK_COMMENT,:VCUST_ID,:VOPER_USER,now(),now())";
  public static String links_UPDATE_BY_ID = "update links set link_name=:VLINK_NAME, link_addr=:VLINK_ADDR, link_comment=:VLINK_COMMENT, cust_id=:VCUST_ID, oper_user=:VOPER_USER,oper_time=now() where trade_id=:VTRADE_ID";
  public static String links_DELETE_INDEX_BY_IDX = "delete from links where trade_id=:VTRADE_ID";
  public static String links_RELOAD_STOCK_BY_TRADE_ID = "delete from links where trade_id=:VTRADE_ID";
  public static String links_SEL_LINK_BY_CUST_ID = "select link_name,link_addr from links where cust_id=:VCUST_ID order by oper_time desc";
}

